//
//  PublicMethodEngine.h
//  GrowUP
//
//  Created by Hobo.Chen on 7/8/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

#define D_MINUTE	60
#define D_HOUR		3600
#define D_DAY		86400
#define D_WEEK		604800
#define D_YEAR		31556926

@interface PublicMethodEngine : NSObject {

}

+ (PublicMethodEngine *)sharedPublicMethodEngine;

- (NSString *)dataFilePath:(NSString *)filename;

- (BOOL)saveData:(NSData *)data filePath:(NSString *)filePath;

//read data

- (NSData *)readData:(NSString *)filePath;


- (NSString *)pathOfFileWithSuffix:(NSString *)suffix folder:(NSString *)folder;

- (NSString *)filename:(NSString *)filename  suffix:(NSString *)suffix folder:(NSString *)folder;

- (NSString *)dateInFormat:(NSString*) stringFormat;

-(BOOL)deleteFileWith:(NSString *)path;

- (BOOL)isFolderExitWith:(NSString *)filePath;

- (NSString *)documentPathWithFolder:(NSString *)folder;

- (BOOL)createFolder:(NSString *)folder;

- (int)getIntFromDict:(NSDictionary *)dict keyStr:(NSString *)ketStr;

- (NSString *)getStrFromDict:(NSDictionary *)dict keyStr:(NSString *)ketStr;
- (BOOL)getBoolFromDict:(NSDictionary *)dict keyStr:(NSString *)keyStr;

- (NSData *)getDataFromDict:(NSDictionary *)dict keyStr:(NSString *)keyStr;

- (NSDate *)getDateFromDict:(NSDictionary *)dict keyStr:(NSString *)keyStr;

-(NSString *)NSDateToNSTring:(NSDate *)nsDate;

- (NSDate *)NSStringDateToNSDate:(NSString *)string ;
- (NSDate *) dateWithDaysFromDate: (NSUInteger) days date:(NSDate *)date;

-(UIImage *)imageFromText:(NSString *)text width:(float)width height:(float)height;
-(UIImage *)compresImageWith:(UIImage *)image maxPix:(float)maxPix;
-(NSData *)compresImageDataWith:(UIImage *)image maxPix:(float)maxPix;
-(UIImage *)compressImageWith:(UIImage *)image width:(float)width height:(float)height;

//将一张图片向左或向右旋转90度
- (UIImage *)rotImageRightOrLeft:(UIImage *)image isRight:(BOOL)isRight;
//将一张图片旋转angle度
- (UIImage *)rotImageZeroWith:(UIImage *)image rotAngle:(float)angle;

//将字符串转成字典
- (NSMutableDictionary *)stringToDictionary:(NSString *)string;

//转义符过滤

-(NSString *)changeStringFommat:(NSString *)str;

- (float) getFreeDiskspaceMiB;
@end
